#ifndef __SN32F240_KB_CODE_H
#define __SN32F240_KB_CODE_H


/*_____ I N C L U D E S ____________________________________________________*/
#include <SN32F280.h>
#include <SN32F200_Def.h>


/*_____ D E F I N I T I O N S ______________________________________________*/
/****************************************************************************
; Bit mask definitions
****************************************************************************/
#define			BIT_0					(0x01<<0)
#define			BIT_1					(0x01<<1)
#define			BIT_2					(0x01<<2)
#define			BIT_3					(0x01<<3)
#define			BIT_4					(0x01<<4)
#define			BIT_5					(0x01<<5)
#define			BIT_6					(0x01<<6)
#define			BIT_7					(0x01<<7)
#define			BIT_8					(0x01<<8)
#define			BIT_9					(0x01<<9)
#define			BIT_10				(0x01<<10)
#define			BIT_11				(0x01<<11)
#define			BIT_12				(0x01<<12)
#define			BIT_13				(0x01<<13)
#define			BIT_14				(0x01<<14)
#define			BIT_15				(0x01<<15)

#define			KEY_REC				0x00
#define			KEY_A					0x04
#define			KEY_B					0x05
#define			KEY_C					0x06
#define			KEY_D					0x07
#define			KEY_E					0x08
#define			KEY_F					0x09
#define			KEY_G					0x0A
#define			KEY_H					0x0B
#define			KEY_I					0x0C
#define			KEY_J					0x0D
#define			KEY_K					0x0E
#define			KEY_L					0x0F
#define			KEY_M					0x10
#define			KEY_N					0x11
#define			KEY_O					0x12
#define			KEY_P					0x13
#define			KEY_Q					0x14
#define			KEY_R					0x15
#define			KEY_S					0x16
#define			KEY_T					0x17
#define			KEY_U					0x18
#define			KEY_V					0x19
#define			KEY_W					0x1A
#define			KEY_X					0x1B
#define			KEY_Y					0x1C
#define			KEY_Z					0x1D
#define			KEY_1					0x1E
#define			KEY_2					0x1F
#define			KEY_3					0x20
#define			KEY_4					0x21
#define			KEY_5					0x22
#define			KEY_6					0x23
#define			KEY_7					0x24
#define			KEY_8					0x25
#define			KEY_9					0x26
#define			KEY_0					0x27
#define			KEY_ENTER			0x28
#define			KEY_ESCAPE		0x29
#define			KEY_BACKSPACE	0x2A
#define			KEY_TAB				0x2B
#define			KEY_SPACEBAR	0x2C
#define			KEY_MIS				0x2D		//-_
#define			KEY_EQU				0x2E		//=+
#define			KEY_OQO				0x2F		//[{
#define			KEY_EQO				0x30		//]}
#define			KEY_BSL				0x31		//\|
#define			KEY_COL				0x33		//;:
#define			KEY_CC				0x34		//'"
#define			KEY_GAT				0x35		//`~
#define			KEY_CMA				0x36		//,<
#define			KEY_DOT				0x37		//.>
#define			KEY_SL				0x38		///?

#define			KEY_CAPLOCK		0x39
#define			KEY_F1				0x3A
#define			KEY_F2				0x3B
#define			KEY_F3				0x3C
#define			KEY_F4				0x3D
#define			KEY_F5				0x3E
#define			KEY_F6				0x3F
#define			KEY_F7				0x40
#define			KEY_F8				0x41
#define			KEY_F9				0x42
#define			KEY_F10				0x43
#define			KEY_F11				0x44
#define			KEY_F12				0x45
#define			KEY_PRINT			0x46
#define			KEY_SCROLL		0x47
#define			KEY_PAUSE			0x48
#define			KEY_INSERT		0x49
#define			KEY_HOME			0x4A
#define			KEY_PAGEUP		0x4B
#define			KEY_DELETE		0x4C
#define			KEY_END				0x4D
#define			KEY_PAGEDOWN	0x4E
#define			KEY_RIGHT			0x4F
#define			KEY_LEFT			0x50
#define			KEY_DOWN			0x51
#define			KEY_UP				0x52
#define			KEY_NUMLOCK		0x53
#define			KEY_PADNSL		0x54				//Pad/
#define			KEY_PADNMU		0x55				//Pad*
#define			KEY_PADNMI		0x56				//Pad-
#define			KEY_PADNPL		0x57				//Pad+
#define			KEY_PADENTER	0x58
#define			KEY_PAD1			0x59
#define			KEY_PAD2			0x5A
#define			KEY_PAD3			0x5B
#define			KEY_PAD4			0x5C
#define			KEY_PAD5			0x5D
#define			KEY_PAD6			0x5E
#define			KEY_PAD7			0x5F
#define			KEY_PAD8			0x60
#define			KEY_PAD9			0x61
#define			KEY_PAD0			0x62
#define			KEY_PADDEL		0x63
#define			KEY_APPLICATION	0x65

/****************************************************************************
; Standard USB usage codes for different languages 
****************************************************************************/
#define			KEY_K29				0x31			//K29
#define			KEY_K42				0x32			//K42	
#define			KEY_K45				0x64			//K45	
#define			KEY_K56				0x87			//K56	
#define			KEY_K133			0x88			//K133
#define			KEY_K14				0x89			//K14	
#define			KEY_K132			0x8A			//K132
#define			KEY_K131			0x8B			//K131
#define			KEY_K150			0x91			//K150
#define			KEY_K151			0x90			//K151
#define			KEY_K107			0x85			//K107

/****************************************************************************
; user define spec function
****************************************************************************/
#define			KEY_ALT_TAB								0x92
#define			KEY_WIN_E									0x93
#define			KEY_WIN_TAB								0x94
#define			KEY_WIN_Q									0x95
#define			KEY_ALT_ESC								0x96
#define			KEY_WIN_H									0x97
#define			KEY_WHEEL									0x98
#define			KEY_OLED_LIGHT						0x99
#define			KEY_OLED_SPEED						0x9A
#define			KEY_OLED_SWITCH						0x9B
#define			KEY_OLED_COLOUR_SWITCH		0x9C
#define			KEY_LED_ON_OFF						0x9F
/****************************************************************************
; Modifier key's usage key code.
****************************************************************************/
#define			KEY_LEFTCTRL      				0xe0	
#define			KEY_LEFTSHIFT      				0xe1	 
#define			KEY_LEFTALT       				0xe2	
#define			KEY_LEFTGUI           		0xe3	
#define			KEY_RIGHTCTRL         		0xe4	 
#define			KEY_RIGHTSHIFT         		0xe5	 
#define			KEY_RIGHTALT          		0xe6	 
#define			KEY_RIGHTGUI           		0xe7	 

/****************************************************************************
; System control's temp code. 
****************************************************************************/
#define			SYSKEY_POWER	  		     	0xa8    // system control POWER
#define			SYSKEY_SLEEP  		       	0xa9    // system control SLEEP
#define			SYSKEY_WAKEUP 		      	0xaa    // system control WAKEUP

/****************************************************************************
; Special function's temp code.
****************************************************************************/
#define			KEY_LOCK									0xAE
#define			KEY_FN										0xAF

/****************************************************************************
; Consumer hot key's Index and its usge code
****************************************************************************/
#define			CSMKEY_BASE								0xb0

#define			CSMKEY_NTRACK_INDEX 	    0xb0    // (0c b5) scan next track
#define			CSMKEY_NTRACK							0xb5
/*--------------------------------------------------------------------------*/
#define			CSMKEY_PTRACK_INDEX 	    0xb1    // (0c b6) scan previous track
#define			CSMKEY_PTRACK							0xb6
/*--------------------------------------------------------------------------*/
#define			CSMKEY_STOP_INDEX   	    0xb2    // (0c b7) stop
#define			CSMKEY_STOP								0xb7
/*--------------------------------------------------------------------------*/
#define			CSMKEY_PLAYPAUSE_INDEX    0xb3    // (0c cd) play/pause
#define			CSMKEY_PLAYPAUSE					0xcd
/*--------------------------------------------------------------------------*/
#define			CSMKEY_VOLUME_INDEX				0xb4		// (0c e0) Volume
#define			CSMKEY_VOLUME							0xe0
/*--------------------------------------------------------------------------*/
#define			CSMKEY_MUTE_INDEX         0xb5    // (0c e2) mute
#define			CSMKEY_MUTE								0xe2
/*--------------------------------------------------------------------------*/
#define			CSMKEY_BASS_INDEX         0xb6    // (0c e3) bass
#define			CSMKEY_BASS								0xe3
/*--------------------------------------------------------------------------*/
#define			CSMKEY_TREBLE_INDEX		    0xb7    // (0c e4) treble
#define			CSMKEY_TREBLE							0xe4
/*--------------------------------------------------------------------------*/
#define			CSMKEY_BASSBOOST_INDEX	  0xb8    // (0c e5) bass boost
#define			CSMKEY_BASSBOOST					0xe5
/*--------------------------------------------------------------------------*/
#define			CSMKEY_VOLINC_INDEX       0xb9    // (0c e9) volume increment
#define			CSMKEY_VOLINC							0xe9
/*--------------------------------------------------------------------------*/
#define			CSMKEY_VOLDEC_INDEX       0xba    // (0c ea) volume decrement
#define			CSMKEY_VOLDEC							0xea
/*--------------------------------------------------------------------------*/
#define			CSMKEY_BASSINC_INDEX      0xbb    // (0c 152) bass increment
#define			CSMKEY_BASSINC						0x152
/*--------------------------------------------------------------------------*/
#define			CSMKEY_BASSDEC_INDEX      0xbc    // (0c 153) bass decrement
#define			CSMKEY_BASSDEC						0x153
/*--------------------------------------------------------------------------*/
#define			CSMKEY_TREBLEINC_INDEX    0xbd    // (0c 154) treble increment
#define			CSMKEY_TREBLEINC					0x154
/*--------------------------------------------------------------------------*/
#define			CSMKEY_TREBLEDEC_INDEX    0xbe    // (0c 155) treble decrement
#define			CSMKEY_TREBLEDEC					0x155
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ALEMAIL_INDEX    	0xbf    // (0c 18a) al email reader
#define			CSMKEY_ALEMAIL						0x18a
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACSEARCH_INDEX    	0xc0    // (0c 221) ac search
#define			CSMKEY_ACSEARCH						0x221
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACHOME_INDEX  	    0xc1    // (0c 223) ac home (??)
#define			CSMKEY_ACHOME							0x223
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACBACK_INDEX       0xc2    // (0c 224) ac back
#define			CSMKEY_ACBACK							0x224
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACFORWARD_INDEX	  0xc3    // (0c 225) ac forward
#define			CSMKEY_ACFORWARD					0x225
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACSTOP_INDEX     	0xc4    // (0c 226) ac stop
#define			CSMKEY_ACSTOP							0x226
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACREFRESH_INDEX   	0xc5    // (0c 227) ac refresh
#define			CSMKEY_ACREFRESH					0x227
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACBOOKMARK_INDEX 	0xc6    // (0c 22a) ac bookmarks (????)
#define			CSMKEY_ACBOOKMARK					0x22a
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ALCALCULATOR_INDEX 0xc7    // (0c 192) al calculator (???)
#define			CSMKEY_ALCALCULATOR				0x192
;/*--------------------------------------------------------------------------*/
#define			CSMKEY_ALBROWSER_INDE		  0xc8    // (0c 194) al browser (????)
#define			CSMKEY_ALBROWSER					0x194
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ALCONSUMER_INDEX   0xc9    // (0c 183) al consumer control configuration (?????)
#define			CSMKEY_ALCONSUMER					0x183
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACOPEN_INDEX				0xca		// (0c 202) ac open
#define			CSMKEY_ACOPEN							0x202
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACCLOSE_INDEX			0xcb	  // (0c 203) ac close
#define			CSMKEY_ACCLOSE						0x203
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACSAVE_INDEX		  	0xcc	  // (0c 207) ac save
#define			CSMKEY_ACSAVE							0x207
/*--------------------------------------------------------------------------*/
#define			CSMKEY_ACUSER_INDEX		   	0xcd	  // (0c 218) ac user
#define			CSMKEY_ACUSER							0x218
/*--------------------------------------------------------------------------*/
#define			CSMKEY_BRIGHT_INDEX				0xce	  // (0c 21a) ac undo
#define			CSMKEY_BRIGHT							0x6f
/*--------------------------------------------------------------------------*/
#define			CSMKEY_DARKEN_INDEX		  	0xcf	 // (0c b8) Eject
#define			CSMKEY_DARKEN		 					0x70
/*--------------------------------------------------------------------------*/
#define			CSMKEY_BASE_END						0xcf

#define			KEY_RECORD								0xd0
#define			KEY_WinLock								0xd1
#define			KEY_RESET									0xd2
#define			KEY_LED_SWITCH						0xd3
#define			KEY_LED_BRIGHT						0xd4
#define			KEY_LED_DARK							0xd5
#define			KEY_LED_QUICK							0xd6
#define			KEY_LED_SLOW							0xd7
#define			KEY_LED_LEFT							0xd8
#define			KEY_LED_RIGHT							0xd9
#define			KEY_LED_DIR								KEY_LED_LEFT
/*
#define			KEY_LED_COLOUR_DEC				0xda
#define			KEY_LED_COLOUR_INC				0xdb
*/
#define			KEY_LED_COLOUR_SWITCH			0xda
#define     KEY_WIN_SHIFT_S           0xdb
#define     KEY_RF_SWITCH             0xdc
#define     KEY_BT_DEV1             0xdd
#define     KEY_BT_DEV2             0xde
#define     KEY_BT_DEV3             0xdf
//#define			KEY_LED_REC1							0xdc
//#define			KEY_LED_REC2							0xdd
//#define			KEY_LED_REC3							0xde
#define			KEY_LED_TEST							0x02

#define			KEY_MACRO_SET							0xe8
#define			KEY_MACRO_PLAY						0xe9
//#define			KEY_BT_DEV1								0xea
//#define			KEY_BT_DEV2								0xeb
//#define			KEY_BT_DEV3								0xec
#define       KEY_LCD_P               0xea
#define       KEY_LCD_N               0xeb
#define       KEY_LCD_E               0xec

#define			KEY_PAIR_START						0xed
#define			KEY_BT_SWTCH							0xee
#define			KEY_MAC_SWITCH						0xef

#define			KEY_LOGOLED_OFF						0xf0
#define     KEY_LCD_OFF               0xf1

#define			KEY_USB_MODE							0xf4
#define			KEY_SHIFT_CTRL						0xf5
#define			KEY_RF_MODE								0xf6

#define			KEY_WASD									0xf7
#define			KEY_W_UP									0xf8
#define			KEY_A_LEFT								0xf9
#define			KEY_S_DOWN								0xfa
#define			KEY_D_RIGHT								0xfb
#define			KEY_UP_W									0xfc
#define			KEY_LEFT_A								0xfd
#define			KEY_DOWN_S								0xfe
#define			KEY_RIGHT_D								0xff
/****************************************************************************
; Combination key's index definitions
****************************************************************************/
#define     COMB_KEY0_INDEX						0 
#define     COMB_KEY1_INDEX						1
#define     COMB_KEY2_INDEX						2
#define     COMB_KEY3_INDEX						3
#define     COMB_KEY4_INDEX						4
#define     COMB_KEY5_INDEX						5
#define     COMB_KEY6_INDEX						6
#define     COMB_KEY7_INDEX						7
#define     COMB_KEY8_INDEX						8 
#define     COMB_KEY9_INDEX						9
#define     COMB_KEY10_INDEX					10
#define     COMB_KEY11_INDEX					11
#define     COMB_KEY12_INDEX					12
#define     COMB_KEY13_INDEX					13
#define     COMB_KEY14_INDEX					14
#define     COMB_KEY15_INDEX					15
#define     COMB_KEY16_INDEX					16 
#define     COMB_KEY17_INDEX					17
#define     COMB_KEY18_INDEX					18
#define     COMB_KEY19_INDEX					19
#define     COMB_KEY20_INDEX					20
#define     COMB_KEY21_INDEX					21
#define     COMB_KEY22_INDEX					22
#define     COMB_KEY23_INDEX					23
#define     COMB_KEY24_INDEX					24
#define     COMB_KEY25_INDEX					25
#define     COMB_KEY26_INDEX					26 
#define     COMB_KEY27_INDEX					27
#define     COMB_KEY28_INDEX					28
#define     COMB_KEY29_INDEX					29
#define     COMB_KEY30_INDEX					30
#define     COMB_KEY31_INDEX					31
#define     COMB_KEY32_INDEX					32
#define     COMB_KEY33_INDEX					33
#define     COMB_KEY34_INDEX					34
#define     COMB_KEY35_INDEX					35
#define     COMB_KEY36_INDEX					36 
#define     COMB_KEY37_INDEX					37
#define     COMB_KEY38_INDEX					38
#define     COMB_KEY39_INDEX					39
#define     COMB_KEY40_INDEX					40
#define     COMB_KEY41_INDEX					41
#define     COMB_KEY42_INDEX					42
#define     COMB_KEY43_INDEX					43
#endif	/*__SN32F240_KB_CODE_H*/
